package com.deke.stat.controller;

import com.deke.entity.EduSubject02;
import com.deke.stat.service.StatisticsService;
import com.deke.stat.vo.StatisticsVo;
import com.deke.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author ：陈昂（731712841@qq.com）
 * @date ：Created in 2022/12/8 12:04
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/stat")
@Api(tags = "统计图接口类")
public class StatisticsController {
    @Autowired
    private StatisticsService statisticsService;
    /**
     * @create by: 陈昂（731712841@qq.com）
     * @description: 后台统计分析 会员讲师人数接口
     * @create time: 2023/1/30 14:42
     * @param statisticsVo 时间区间
     * @return
     */
   @ApiOperation(value = "会员讲师人数接口")
   @ApiImplicitParams({
           @ApiImplicitParam(value = "时间区间",name = "StatisticsVo")
   })
    @PostMapping("/member/queryMemberTypeBang")
    private HashMap  queryMemberTypeBang(@RequestBody StatisticsVo statisticsVo){
        HashMap<String , List<Integer>> map = new HashMap<>();
        List<Integer> integers = statisticsService.selectCountTeachers();
        List<Integer> integers1 = statisticsService.selectCountStudent();
        map.put("teachers",integers);
        map.put("student",integers1);
        return  map;
    }
    /**
     * @create by: chenang（731712841@qq.com）
     * @description: 后台统计分析课程统计分类
     * @create time: 2023/1/30 14:43
     * @param statisticsVo 时间区间
     * @return 
     */
    @ApiOperation(value = "课程统计分类")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "时间区间",name = "StatisticsVo")
    })
    @PostMapping("/order/queryAllOrderBang")
    private Result<List<EduSubject02>> queryAllOrderBang(@RequestBody StatisticsVo statisticsVo){
       return   statisticsService.selectQueryAll(statisticsVo);
    }
    /**
     * @create by: 陈昂（731712841@qq.com）
     * @description: 后台统计分析 课程销售
     * @create time: 2023/1/30 14:43
     * @param statisticsVo 时间区间
     * @return
     */
    @ApiOperation(value = "课程销售")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "statisticsVo",name = "时间区间")
    })
    @PostMapping("/course/queryAllCourseRanking")
    public Result<List<EduSubject02>> querAllEduCourse(@RequestBody StatisticsVo statisticsVo){
       return statisticsService.courseSales(statisticsVo);
    }
}
